import time


def smurf():
  sp = []
  file = open("m1_sorted.txt")
  for i in file:
    sp.append(i)
  file.close()
  start = time.perf_counter()
  for i in range(len(sp)):
    for j in range(len(sp) - i - 1):
      if sp[j] > sp[j + 1]:
        sp[j], sp[j + 1] = sp[j + 1], sp[j]
  end = time.perf_counter()
  print(round((end - start) * 1000))
  sp = []
  file = open("m2_reverse.txt")
  for i in file:
    sp.append(i)
  file.close()
  start = time.perf_counter()
  for i in range(len(sp)):
    for j in range(len(sp) - i - 1):
      if sp[j] > sp[j + 1]:
        sp[j], sp[j + 1] = sp[j + 1], sp[j]
  end = time.perf_counter()
  print(round((end - start) * 1000))
  sp = []
  file = open("m3_shuffle.txt")
  for i in file:
    sp.append(i)
  file.close()
  start = time.perf_counter()
  for i in range(len(sp)):
    for j in range(len(sp) - i - 1):
      if sp[j] > sp[j + 1]:
        sp[j], sp[j + 1] = sp[j + 1], sp[j]
  end = time.perf_counter()
  print(round((end - start) * 1000))


smurf()
